-
Notifications
You must be signed in to change notification settings - Fork 693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WASM support for Flutter web #1481
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the import it looks good!
Thanks for the PR 😍
pubspec.yaml
Outdated
@@ -17,6 +17,8 @@ dependencies: | |||
path: ^1.8.2 | |||
win32: ^5.1.1 | |||
cross_file: ^0.3.3+7 | |||
js: ^0.7.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that intended?
It's not used anymore and doesn't work with WASM anyways :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is a mistake, I removed it I don’t use it anyway
thanks
@IchordeDionysos You have to be a team member of this project to pass CI approval requirements 😁 |
Yeah true :D But given I've looked over it, I figured it can't hurt :P |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor remarks
lib/_internal/file_picker_web.dart
Outdated
@@ -58,7 +60,9 @@ class FilePickerWeb extends FilePicker { | |||
Completer<List<PlatformFile>?>(); | |||
|
|||
String accept = _fileType(type, allowedExtensions); | |||
InputElement uploadInput = FileUploadInputElement() as InputElement; | |||
HTMLInputElement uploadInput = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTMLInputElement uploadInput = | |
HTMLInputElement uploadInput = HTMLInputElement(); |
The constructor calls document.createElement under the hood.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactored
lib/_internal/file_picker_web.dart
Outdated
@@ -101,7 +105,12 @@ class FilePickerWeb extends FilePicker { | |||
} | |||
} | |||
|
|||
for (File file in files) { | |||
for (var i = 0; i < files.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (var i = 0; i < files.length; i++) { | |
for (int i = 0; i < files.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactored
lib/_internal/file_picker_web.dart
Outdated
|
||
//Add input element to the page body | ||
_target.children.clear(); | ||
var firstChild = _target.firstChild; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to use the real type instead of var
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactored
I added the change requests |
Adding WASM support to close
#1480
Test by Flutter Beta channel or master channel and build by the following command
flutter build web --wasm